<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class News extends CI_Model
{
    function getAll()
    {
        $data = array();
        $this->db->cache_on(3);
        $this->db->select('title , content , dateline');
        $this->db->from('news');
        //$this->db->where('nid',2);
        $q = $this->db->get();
        if($q->num_rows() > 0)
        {
            foreach($q->result() as $r)
            {
                $data[] = $r;
            }
        }
        return $data;
    }
    function insert($data = array())
    {
        if(!empty($data))
        {
            $this->db->insert('news' ,$data);
            return true;
        }
        else
        {
            return false;
        }
        
    }
}
?>